﻿using Simulation.Framework;
using UnityEngine.Events;
using UnityEngine.UI;
using UnityEngine;
using System.Collections.Generic;
using System.Collections;

namespace Easy.Game2d {

    public partial class UIPagePanel : PanelBase {

        public UnityEngine.UI.Button btnshanghaiButton{get;private set;}

        public UnityEngine.UI.Button btnxueliangButton{get;private set;}

        public UnityEngine.UI.Button btndoupengButton{get;private set;}

        public UnityEngine.UI.Button btnOFFButton{get;private set;}

        #region control
        private void InitComponent() {
            // init
            btnshanghaiButton = transform.Find("Image/btnshanghai").GetComponent<UnityEngine.UI.Button>();
            btnxueliangButton = transform.Find("Image/btnxueliang").GetComponent<UnityEngine.UI.Button>();
            btndoupengButton = transform.Find("Image/btndoupeng").GetComponent<UnityEngine.UI.Button>();
            btnOFFButton = transform.Find("Image/btnOFF").GetComponent<UnityEngine.UI.Button>();

            // button
            btnshanghaiButton.onClick.RemoveAllListeners();
            btnshanghaiButton.onClick.AddListener(OnBtnshanghaiButtonClicked);
            btnxueliangButton.onClick.RemoveAllListeners();
            btnxueliangButton.onClick.AddListener(OnBtnxueliangButtonClicked);
            btndoupengButton.onClick.RemoveAllListeners();
            btndoupengButton.onClick.AddListener(OnBtndoupengButtonClicked);
            btnOFFButton.onClick.RemoveAllListeners();
            btnOFFButton.onClick.AddListener(OnBtnOFFButtonClicked);
        }

        private void ClearComponent() {
            // button
            btnshanghaiButton?.onClick.RemoveAllListeners();
            btnxueliangButton?.onClick.RemoveAllListeners();
            btndoupengButton?.onClick.RemoveAllListeners();
            btnOFFButton?.onClick.RemoveAllListeners();

            // clear
            btnshanghaiButton = null;
            btnxueliangButton = null;
            btndoupengButton = null;
            btnOFFButton = null;
        }
        #endregion


    }
}
